<?
	include('link_utility.inc');
	
	
	
	//Testing a multi-level link
	$link = "http://www.example.com/games/index.php";
	$rel  = "fav.php";
	$exp  = "http://www.example.com/games/";
	echo "<b>Testing Link: $link; relative link = $rel</b><br />";
	$ret = getAbsolutePath($link, $rel);
	if($ret == $exp)
		echo "<font color = 'green'>PASS</font> Response = $ret";
	else 	
		echo "<font color = 'red'>FAIL</font> Response = $ret";
		
	//Testing a multi-level link with single indirection
	$link = "http://www.example.com/games/index.php";
	$rel  = "../fav.php";
	$exp  = "http://www.example.com/";
	echo "<br /><b>Testing Link: $link; relative link = $rel</b><br />";
	$ret = getAbsolutePath($link, $rel);
	if($ret == $exp)
		echo "<font color = 'green'>PASS</font> Response = $ret";
	else 	
		echo "<font color = 'red'>FAIL</font> Response = $ret";
		
	//Testing a multi-level link with double indirection
	$link = "http://www.example.com/games/1/index.php";
	$rel  = "../../fav.php";
	$exp  = "http://www.example.com/";
	echo "<br /><b>Testing Link: $link; relative link = $rel</b><br />";
	$ret = getAbsolutePath($link, $rel);
	if($ret == $exp)
		echo "<font color = 'green'>PASS</font> Response = $ret";
	else 	
		echo "<font color = 'red'>FAIL</font> Response = $ret";
		
	//Testing a multi-level link with single indirection & directory
	$link = "http://www.example.com/games/index.php";
	$rel  = "../games/fav.php";
	$exp  = "http://www.example.com/";
	echo "<br /><b>Testing Link: $link; relative link = $rel</b><br />";
	$ret = getAbsolutePath($link, $rel);
	if($ret == $exp)
		echo "<font color = 'green'>PASS</font> Response = $ret";
	else 	
		echo "<font color = 'red'>FAIL</font> Response = $ret";	
		
	$link = "http://www.example.com/games/index.php";
	echo "<br />";
	echo "Host is: " . getHost($link);
	
	
	echo "<br><br>";
	echo strstr("previous", "previous");
	echo "<br>";
	echo strstr("cfsarason@ucdavis.edu", "@");



?>